﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Electrical;

namespace YArchitech.Revit.Electric
{
	public static class RevitDocumentEx
	{
		public static ICollection<ElementId> DeleteElement(this Document revitDocument, ElementSet elemSet)
		{
			ICollection<ElementId> collection = new List<ElementId>();
			foreach (object obj in elemSet)
			{
				Element elem = (Element)obj;
				new List<ElementId>();
				foreach (ElementId item in revitDocument.DeleteElement(elem))
				{
					collection.Add(item);
				}
			}
			return collection;
		}

		public static ElectricalSystem CreateHyElectricalSystem(this Document revitDocument, ElementSet elemSet, ElectricalSystemType elecSysType)
		{
			ICollection<ElementId> collection = new List<ElementId>();
			foreach (object obj in elemSet)
			{
				Element element = (Element)obj;
				collection.Add(element.Id);
			}
			return revitDocument.Create.NewElectricalSystem(collection, elecSysType);
		}
	}
}
